import request from '@/utils/request';

// 查询分类列表
export function listCategory(data = {}) {
  return request({
    url: '/article/category/list',
    method: 'post',
    data
  })
}

// 根据分类ID查询分类信息
export function info(categoryId) {
  return request({
    url: `/article/api/category/info/${categoryId}`,
    method: 'get'
  })
}

// 根据创建者ID查询分类列表
export function getInfoByCreaterId(userId) {
  return request({
    url: `/article/api/category/getInfoByCreaterId/${userId}`,
    method: 'get'
  })
}

// 删除分类
export function deleteCategory(data) {
  return request({
    url: '/article/category/delete',
    method: 'post',
    data
  })
}

// 创建分类
export function createCategory(data) {
  return request({
    url: '/article/category/create',
    method: 'post',
    data
  })
}

// 编辑分类
export function editCategory(data) {
  return request({
    url: '/article/category/edit',
    method: 'post',
    data
  })
}

// 保存分类下的标签信息
export function saveCategoryLabel(data) {
  return request({
    url: '/article/category/saveCategoryLabel',
    method: 'post',
    data
  })
}
